<%@ include file="include.jsp" %>
<html>
<head>
<%@include file="header.jsp" %>
<title>Debug</title>
<script type="text/javascript"> 
  function doAjaxPost(){
		// get form values
		var sqls = $("#sqls").val();
		
		// for special charactors %, &, +
		sqls = sqls.replace(/\%/g,"%25");
		sqls = sqls.replace(/\&/g,"%26");
		sqls = sqls.replace(/\+/g,"%2B");
		$.ajax(
			{
				type: "POST",
				url:  "/dashboard/admin/executeSQL",
				data: "sqls=" + sqls,
				success: function(response){
					$("#box2").html(response);
				},
				error: function(e){
					alert("Error Ajax Request: " + e);
				}
			}
		);
	}
</script>
</head>
<body>
<div id="bg">
	<div id="outer">
		<div id="header">
			<div id="logo">
				<h1>
				Database Tuning
				</h1>
			</div>
	    	<%@include file="navigation.jsp" %>
	    </div>
		<div id="main">
				<div id="box1">
				<fieldset>
				<legend>SQL Commands</legend>
				<dl>
				<dd><textarea id="sqls" name="sqls" rows="10" cols="130"></textarea></dd>
				</dl>
				</fieldset>
				<fieldset>
				<input type="submit" value="Execute" onclick="doAjaxPost()" />
				</fieldset>
				</div>
				<div id="box2"></div>
			<br class="clear" />
		</div>
		<%@include file="footer.jsp" %>
	</div>
</div>		
</body>
</html>